import 'package:crawler/global/color.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';

import 'main_cont.dart';

class MainPage extends GetView<MainCont> {
  const MainPage({super.key});

  @override
  Widget build(BuildContext context) {
    return Obx(() => Scaffold(
      body: controller.screens[controller.index.value],
      bottomNavigationBar: BottomNavigationBar(
        backgroundColor: LWColor.barColor,
        unselectedItemColor: LWColor.normalColor,
        selectedItemColor: LWColor.selectedColor,
        items: [
          BottomNavigationBarItem(
              icon: Image.asset("assets/icons/item_course_nor.png", height: 30, fit: BoxFit.contain),
              activeIcon: Image.asset("assets/icons/item_course_sel.png", height: 30, fit: BoxFit.contain),
              label: '课程'),
          BottomNavigationBarItem(
              icon: Image.asset('assets/icons/item_history_nor.png', height: 30, fit: BoxFit.contain),
              activeIcon: Image.asset('assets/icons/item_history_sel.png', height: 30, fit: BoxFit.contain),
              label: '历史')
        ],
        currentIndex: controller.index.value,
        onTap: (index) {
          controller.index.value = index;
        },
      ),
    ));
  }

}